#ifndef QTUI_QT_UNDOABLE_COMMAND_HPP
#define QTUI_QT_UNDOABLE_COMMAND_HPP

#include "QtUI/QtUIConfig.hpp"
#include <QtGui/QUndoCommand>

namespace Ctrl { class ControlCommand; }

namespace QtUI
{

/// @ingroup QtUI
/// @brief It integrates the undoable control commands in QT framework by wrapping them and delegating the undo/redo 
///		method calls.
///
/// See @ref QtUndoableCommands "Undoable Commands integrated with QT"
class QTUI_API QtUndoableCommand: public QUndoCommand
{
public:
	/// @brief It initializes the command.
	/// @param text the title of the command, as it should be displayed in undo and redo command lists.
	/// @param pCtrlCommand the wrapped control command.
	QtUndoableCommand( const QString& text, Ctrl::ControlCommand* pCtrlCommand);

	/// @brief It deletes the wrapped command.
	virtual ~QtUndoableCommand();

	/// @brief It executes the command. 
	/// @sa Ctrl::ControlCommand::execute()
	virtual void undo();

	/// @brief It reverts the command. 
	/// @sa Ctrl::ControlCommand::undo()
	virtual void redo();

private:
	/// @brief The wrapped command.
	Ctrl::ControlCommand* pImpl_;
};

} // namespace QtUI

#endif // QTUI_QT_UNDOABLE_COMMAND_HPP
